/*
 * @Author: zhangyang
 * @Date: 2021-11-19 19:25:34
 * @LastEditTime: 2021-11-19 19:49:29
 * @Description: 
 */
'use strict';

module.exports = {
  up: async (queryInterface, Sequelize) => {
    // 创建 node 表
    const { INTEGER, TINYINT, DATE, STRING } = Sequelize;
    await queryInterface.createTable(`node`, {
      autoid: { type: INTEGER, primaryKey: true, autoIncrement: true  },
      is_show: { type: TINYINT, allowNull: false, defaultValue: 1 },
      node_desc: { type: STRING, allowNull: false, defaultValue: '' },
      node_name: { type: STRING, allowNull: false, defaultValue: '' },
      node_path: { type: STRING, allowNull: false, defaultValue: '' },
      node_sort: { type: INTEGER, allowNull: false, defaultValue: 0 },
      node_type: { type: TINYINT, allowNull: false, defaultValue: 0 },
      parent_id: { type: INTEGER, allowNull: true, defaultValue: null }
    }, {
      engine: 'InnoDB',
      charset: 'utf8mb4'
    })
  },
  down: async (queryInterface) => {
    await queryInterface.dropTable('node');
  }
};
